package com.itheima.d5_resource;

import java.io.*;

/*
     目标：掌握释放资源的方式：try-with-resource
 */
public class Test3 {
    public static void main(String[] args)  {

        try(FileInputStream fis = new FileInputStream("D:\\学习\\毕业设计\\备份\\初稿_王鹏飞_毕业设计1-7.pdf");
            FileOutputStream fos = new FileOutputStream("哈哈.pdf")
        ){
            int len;
            byte[] bytes = new byte[1024];
            while ((len = fis.read(bytes )) != -1) fos.write(bytes,0,len);
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
